package com.naiterui.ehp.bs.patient.repository;

import java.util.Collection;
import java.util.List;

import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import com.naiterui.common.repository.core.BaseJpaRepository;
import com.naiterui.ehp.bp.domain.Hospital;

/**
 * <pre>
 * 医院持久化实现
 * </pre>
 *
 * @author fangguanhong
 * @date 2020/4/10 下午4:19
 * @since 1.0.0
 */
@Repository
public interface IApHospitalRepository extends BaseJpaRepository<Hospital, Integer> {

    @Query("select h from Hospital h where h.hide=0 and h.name like %?1% order by h.createdAt desc")
    List<Hospital> findByNameLike(String name);

    List<Hospital> findByHideAndCityIdInOrderByCreatedAtDesc(Integer hide, List<Integer> cityIds);

    List<Hospital> findByIdIn(Collection<Integer> ids);
}
